<?php
include_once("config.php");
$dirs=glob($config["WIDGET_DIR"]."*");
$widgetList = array();
foreach($dirs as $dir){
	$jsonFile = $dir."/json.php";
	if(file_exists($jsonFile)){
		$widgetList[] = json_decode(file_get_contents($jsonFile),true);	
	}
}
?>
<div class="ready-widget-list">
<?php
foreach($widgetList as $widget){
?>
	<div class="ready-widget-entry">
    	<div class="ready-widget-title"><? echo $widget["title"];?></div>
        <div class="ready-widget-info">
        	<div class="ready-widget-intro"><? echo $widget["about"]['intro'];?></div>
        	<div class="ready-widget-about">
                <span>作者:</span><? echo $widget["about"]['author'];?>
                <span>网站:</span><? echo $widget["about"]['site'];?>
                <span>邮箱:</span><? echo $widget["about"]['email'];?>
            </div>
        </div>
        <div class="ready-widget-action">
        	<input type="button" value="添加" name="add" onclick="WidgetHelper.addWidgetAction('<? echo $widget["title"];?>','<? echo $widget["name"];?>');" />
        </div>
        <div class="clear"></div>
    </div>
<?php
}
?>
</div>